/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sgt.supermarket.util;

import java.util.Date;

/**
 *
 * @author Administrator
 */
public class DateExtensions {

    public static String getDateString(int date) {
        String format = "%dth";
        if (date % 10 <= 3) {
            if (date < 10 || date > 20) {
                switch (date % 10) {
                    case 1:
                        format = "%dst";
                        break;
                    case 2:
                        format = "%dnd";
                        break;
                    case 3:
                        format = "%drd";
                        break;
                }
            }
        }
        return String.format(format, date);
    }

    public static String getMonthString(int month) {
        Date d = new Date(2010 - 1900, month - 1, 1);
        return Converter.toString(d, "MMMM");
    }
}
